const Mock = require('mockjs')

const data = Mock.mock({
  'items|10': [{
    no: '0',
    id: '@id',
    name: '张三',
    password: /^[\u4E00-\u9FA5A-Za-z0-9_]+$/,
    company: '子公司1',
    dept: '第一生产对',
    role: '会员',
    sex: '男',
    birth: /^\d{4}-\d{1,2}-\d{1,2}/,
    tel: /^(13[0-9]|17[0-9]|14[5|7]|15[0-9]|18[0-9]|19[4|5])\d{8}$/
  }]
})

const data2 = [
  { no: '0',
    id: '1001',
    name: '管理员',
    password: '111111',
    company: '子公司1',
    dept: '第一生产对',
    role: ['admin'],
    sex: '男',
    birth: '2000-12-23',
    tel: '17784472335' },
  { no: '0',
    id: '1002',
    name: 'editor',
    password: '111111',
    company: '子公司1',
    dept: '第一生产对',
    role: ['editor'],
    sex: '男',
    birth: '2000-12-23',
    tel: '1778423442' }]

module.exports = [
  {
    url: '/user/userTable/getALl',
    type: 'get',
    response: config => {
      const items = data2
      return {
        code: 20000,
        data: {
          total: items.length,
          items: items
        }
      }
    }
  }
]
